package com.dkm.dkmproject.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.dkm.dkmproject.dao.WalletTbMapper;
import com.dkm.dkmproject.domain.WalletTb;
import com.dkm.dkmproject.service.IWalletTbService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 钱包表 服务实现类
 * </p>
 *
 * @author 周佳佳
 * @since 2020-04-26
 */
@Service
public class WalletTbServiceImpl extends ServiceImpl<WalletTbMapper, WalletTb> implements IWalletTbService {
    @Resource
    WalletTbMapper walletTbMapper;
    @Override
    public int addWalletTb(WalletTb walletTb) {
        return walletTbMapper.insert(walletTb);
    }

    @Override
    public List<WalletTb> findUserId(Integer userId) {
        EntityWrapper<WalletTb> entityWrapper=new EntityWrapper();
        entityWrapper.eq("user_id",userId);
        List<WalletTb> list=walletTbMapper.selectList(entityWrapper);
        return list;
    }

    @Override
    public int updateByPrimaryKeySelective(WalletTb record) {
        return walletTbMapper.updateByPrimaryKeySelective(record);
    }
}
